<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
	trimDirectiveWhitespaces="true"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>:: JSP 프로젝트 v1 ::</title>
<link href="css/normalize" rel="stylesheet">
<!-- 공통부분 css파일 따로 생성 후 적용 -->
<link href="css/jech913.css" rel="stylesheet">
<style type="text/css">
/*회원가입 폼 정렬*/
#joinfrm {
	/* border: 1px solid red; */
	width: 365px;
	padding-top:120px;
}
#joinfrm label{
	width: 120px;
	text-align:right;
	font-weight:bold;
	display:inline-block;
	padding:0 10px 0 0;
}
#joinfrm div{
	margin:10px 10px;
}
</style>
</head>

<body>
	<!-- 구역 구분-->
	<!-- 상단영역 시작 -->
	<%--동적포함:include지시문과는 달리 포함된 jsp를 각각 실행하고 그 결과만 현재문서에 포함함. 
	 			 즉, join.jsp와 header.jsp, footer.jsp를 따로 실행하고 그 결과만 하나로 합쳐 출력함.--%>
	<jsp:include page="/layout/header.jsp" />
	<!-- 상단영역 끝 -->
	

	<div id="contents">
		<h2>:: 회원가입 ::</h2>
		<form name="joinfrm" id="joinfrm" class="centerme">
			<div>
				<label for="userid">아이디</label><input type="text" name="userid"
					id="userid" />
			</div>
			<div>
				<label for="passwd">비밀번호</label><input type="text" name="passwd"
					id="passwd" />
			</div>
			<div>
				<label for="repwd">비밀번호확인</label><input type="text" name="repasswd"
					id="repasswd" />
			</div>
			<div>
				<label for="name">이름</label><input type="text" name="name" id="name" />
			</div>
			<div>
				<label for="email">전자우편</label><input type="email" name="email"
					id="email" />
			</div>
			<div>
				<label></label>
				<button type="button" id="joinokbtn">입력완료</button>
				<button type="reset" id="joinokbtn">다시입력</button>
			</div>
		</form>
	</div>


	<!-- 하단영역 시작 -->
	<jsp:include page="/layout/footer.jsp" />
	<!-- 하단영역 끝 -->

	<script type="js/jquery-1.11.1.min.js"></script>
	<script type="js/jech913.js"></script>
	<script type="text/javascript">
		var joinbtn = document.getElementById("joinokbtn");
		joinbtn.onclick = function(){joinme();};
	
	</script>
	<script type="text/javascript">
		function joinme(){
			var joinfrm = document.getElementById("joinfrm");
			if(joinfrm.userid.value == "" && joinfrm.passwd.value==""){
				alert('아이디,비밀번호를 입력하세요!');
			}			
			else if(joinfrm.userid.value==""){
				alert('아이디를 입력하세요!!')
			}
			else if(joinfrm.passwd.value==""){
				alert('비밀번호를 입력하세요!!')
			}
			else if(joinfrm.passwd.value != joinfrm.repasswd.value){
				alert('비밀번호가 다릅니다.');				
			}
			else {	
			joinfrm.method = "post";
			joinfrm.action = "joinok.jsp";
			joinfrm.submit();
			}		
			
		} 
	</script>
</body>
</html>